#!/usr/bin/envpython
#-*-coding:utf-8-*-
import redis
import time
from redis_caiji.dingyue import RedisHelper,loginredis
# for i in range(1000):
#     time.sleep(1)
#     obj.publish('192.168.20.210,0,root,root,22,30,0,1')  # 发布
#     time.sleep(2)
#     obj.publish('192.168.20.210,fsfsdfsf,root,root,1,45,30,3')  # 发布
#服务器发送信息表：ip地址，sn，用户名，密码，端口，采集时间，占位符，类型
# obj.publish('192.168.20.210,0,root,root,22,30,0,1')
def sendguangbo(name):
    obj = RedisHelper()
    obj.publish(name)  # 发布
def stopguanbo(name):
    obj = loginredis()
    obj.set(name,0)# 发布
def statusguanbo(name):
    obj = loginredis()
    a = obj.get(name) # 发布
    return a
def guanbodata(name):
    obj = loginredis()
    a = obj.lrange(name + "_disk",0,-1)
    return a
#服务器发送信息表：ip地址，sn，用户名，密码，端口，采集时间，占位符，类型
a = '192.168.20.210,0,root,root,22,5,0,1'
# sendguangbo(a)
# print(statusguanbo(a))
# for i in guanbodata(a):
#     b = bytes.decode(i)
#     a = b.split(",")
#     print(a[0])
# stopguanbo(a)
print(len(guanbodata(a)))
